import {getRecommend} from "../api/common"
let homeStore = {
    namespaced:true,
    state:{
        recommendList:[]
    },
    mutations:{
        getrecommendList(state,list,isRefresh){
            // console.log(state)
            // console.log(12,isRefresh)
            if(isRefresh){
                // console.log("下拉刷新")
                state.recommendList = list
            }else{
              state.recommendList = state.recommendList.concat(list)  
            }
            
        },

    },
    actions:{
        async getrecommend({commit},page,isRefresh){
            // console.log(page)
            var res = await getRecommend({p:page})
            commit('getrecommendList',res.result.data,isRefresh)
            return Promise.resolve(false)
        },

    },
    getters:{
        recommendList:state=>state.recommendList
    }
}

export default homeStore